package de.luh.slimpp.generator

import de.luh.slimpp.slimPP.TypeName
import java.util.ArrayList
import java.util.List
import de.luh.slimpp.slimPP.QualifiedTypeName

/**
 * Extensions to the TypeName to better resolve simple types contained in complex types,
 * e.g. types with template parameters which are themselves types.
 */
class TypeNameExtensions {
	static def List<String> getQualifiedInternalName(TypeName type) {
		val names = new ArrayList<String>
		concatName(type.type, names)
		return names
	}

	static private def void concatName(QualifiedTypeName name, List<String> names) {
		names.add(name.name)
		if (name.hasNext)
			concatName(name.nextType, names)
	}
}